package com.baidu.demo;

import cn.hutool.json.JSONUtil;
import com.baidu.entity.User;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

public class Demo03 {
    public static void main(String[] args) {
        Map<String, Object> map = new HashMap<>();
        map.put("name", "zxsxs");
        map.put("age", 20);
        map.put("gender", "male");

        User user = new User();
        user.setUsername("zhangsan");
        user.setEmail("zhangsan@baidu.com");
        user.setPassword("123456");
        Object data = map.put("data", user);
        String jsonStr = JSONUtil.toJsonStr(map);
        System.out.println(jsonStr);

    }
}
